<?php

/**
 * This is the model class for table "bln_message_transfer".
 *
 * The followings are the available columns in table 'bln_message_transfer':
 * @property integer $_id
 * @property integer $sender_id
 * @property integer $sender_type_id
 * @property integer $receiver_id
 * @property integer $receiver_type_id
 * @property integer $transfer_type_id
 * @property integer $comment_message_id
 * @property integer $original_message_id
 * @property integer $previous_transfer_id
 * @property integer $operation_transaction_id
 * @property integer $transfer_configuration_id
 */
class BMessageTransfer extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @return BMessageTransfer the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'bln_message_transfer';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('sender_id, sender_type_id, receiver_id, receiver_type_id, transfer_type_id, original_message_id, operation_transaction_id, transfer_configuration_id', 'required'),
			array('sender_id, sender_type_id, receiver_id, receiver_type_id, transfer_type_id, comment_message_id, original_message_id, previous_transfer_id, operation_transaction_id, transfer_configuration_id', 'numerical', 'integerOnly'=>true),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('_id, sender_id, sender_type_id, receiver_id, receiver_type_id, transfer_type_id, comment_message_id, original_message_id, previous_transfer_id, operation_transaction_id, transfer_configuration_id', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'_id' => 'ID',
			'sender_id' => 'Sender',
			'sender_type_id' => 'Sender Type',
			'receiver_id' => 'Receiver',
			'receiver_type_id' => 'Receiver Type',
			'transfer_type_id' => 'Transfer Type',
			'comment_message_id' => 'Comment Message',
			'original_message_id' => 'Original Message',
			'previous_transfer_id' => 'Previous Transfer',
			'operation_transaction_id' => 'Operation Transaction',
			'transfer_configuration_id' => 'Transfer Configuration',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('_id',$this->_id);
		$criteria->compare('sender_id',$this->sender_id);
		$criteria->compare('sender_type_id',$this->sender_type_id);
		$criteria->compare('receiver_id',$this->receiver_id);
		$criteria->compare('receiver_type_id',$this->receiver_type_id);
		$criteria->compare('transfer_type_id',$this->transfer_type_id);
		$criteria->compare('comment_message_id',$this->comment_message_id);
		$criteria->compare('original_message_id',$this->original_message_id);
		$criteria->compare('previous_transfer_id',$this->previous_transfer_id);
		$criteria->compare('operation_transaction_id',$this->operation_transaction_id);
		$criteria->compare('transfer_configuration_id',$this->transfer_configuration_id);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}